import {BasicColumn, FormSchema} from '/@/components/Table';
import {commonStatusDict, commonStatusDictMap} from '/@/utils/dict';

export const columns: BasicColumn[] = [
  {
    title: '渠道编码',
    dataIndex: 'channelCode',
  },
  {
    title: '渠道名称',
    dataIndex: 'channelName',
  },
  {
    title: '是否支持普通商户模式: 0-不支持, 1-支持',
    dataIndex: 'isMchMode',
  },
  {
    title: '是否支持服务商子商户模式: 0-不支持, 1-支持',
    dataIndex: 'isIsvMode',
  },
  {
    title: '支付参数配置页面类型:1-JSON渲染,2-自定义',
    dataIndex: 'configPageType',
  },
  {
    title: '支持的支付方式 [\"WX_JSAPI\", \"WX_BAR\"]',
    dataIndex: 'wayCodes',
  },
  {
    title: '页面展示：卡片-图标',
    dataIndex: 'icon',
  },
  {
    title: '页面展示：卡片-背景色',
    dataIndex: 'bgColor',
  },
  {
    title: '状态',
    dataIndex: 'status',
    dictFormat: commonStatusDictMap,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'channelCode',
    label: '渠道编码',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    field: 'channelName',
    label: '渠道名称',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    field: 'isMchMode',
    label: '是否支持普通商户模式',
    component: 'Select',
    defaultValue: 1,
    componentProps: {
      options: [
        {label: '支持', value: 1},
        {label: '不支持', value: 0},
      ],
    },
    colProps: {span: 6},
  },
  {
    field: 'isIsvMode',
    label: '是否支持服务商子商户模式',
    component: 'Select',
    defaultValue: 1,
    componentProps: {
      options: [
        {label: '支持', value: 1},
        {label: '不支持', value: 0},
      ],
    },
    colProps: {span: 6},
  },
  {
    field: 'configPageType',
    label: '支付参数配置页面类型',
    component: 'Select',
    defaultValue: 1,
    componentProps: {
      options: [
        {label: 'JSON渲染', value: 1},
        {label: '自定义', value: 2},
      ],
    },
    colProps: {span: 6},
  },
  {
    field: 'status',
    label: '状态',
    component: 'Select',
    componentProps: {
      options: commonStatusDict,
    },
    colProps: {span: 6},
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },
  {
    field: 'channelName',
    label: '渠道名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'channelCode',
    label: '渠道编码',
    component: 'Input',
    required: true,
  },
  {
    field: 'isMchMode',
    label: '普通商户模式',
    component: 'RadioGroup',
    defaultValue: 1,
    componentProps: {
      options: [
        {label: '支持', value: 1},
        {label: '不支持', value: 0},
      ],
    },
    required: true,
  },
  {
    field: 'isIsvMode',
    label: '服务商子商户模式',
    component: 'RadioGroup',
    defaultValue: 1,
    componentProps: {
      options: [
        {label: '支持', value: 1},
        {label: '不支持', value: 0},
      ],
    },
    required: true,
  },
  {
    field: 'configPageType',
    label: '支付参数配置页面类型',
    defaultValue: 1,
    componentProps: {
      options: [
        {label: 'JSON渲染', value: 1},
        {label: '自定义', value: 2},
      ],
    },
    required: true,
  },
  {
    field: 'isvParams',
    label: 'ISV渠道配置',
    component: 'InputTextArea',
    componentProps: {
      placeholder: 'ISV渠道配置定义描述,json字符串',
    },
    colProps: {lg: 24, md: 24},
  },
  {
    field: 'isvsubMchParams',
    label: '特约商户渠道配置',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '特约商户渠道配置定义描述,json字符串',
    },
    colProps: {lg: 24, md: 24},
  },
  {
    field: 'normalMchParams',
    label: '普通商户渠道配置',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '普通商户渠道配置定义描述,json字符串',
    },
    colProps: {lg: 24, md: 24},
  },
  {
    field: 'wayCodes',
    label: '支持的支付方式',
    component: 'CheckboxGroup',
    componentProps: {
      options: [
        {
          label: '微信JSAPI',
          value: 'WX_JSAPI',
        },
        {
          label: '微信条码',
          value: 'WX_BAR',
        },
      ],
    },
    colProps: {lg: 24, md: 24},
    required: true,
  },
  {
    field: 'icon',
    label: '卡片-图标',
    component: 'Input',
    componentProps: {
      placeholder: '页面展示：卡片-图标',
    },
  },
  {
    field: 'bgColor',
    label: '卡片-背景色',
    component: 'Input',
    componentProps: {
      placeholder: '页面展示：卡片-背景色',
    },
  },
  {
    field: 'status',
    label: '状态',
    component: 'RadioGroup',
    defaultValue: 1,
    componentProps: {
      options: commonStatusDict,
    },
    required: true,
  },
];
